/*
 * constants.h
 *
 *  Created on: 29 de Abr de 2012
 *      Author: Rui
 */

#ifndef CONSTANTS_H_
#define CONSTANTS_H_

#include <iostream>
#include <GL/glut.h>
#include <GL/glu.h>
#include <GL/gl.h>

namespace pacman{

//MATH CONSTANTS
double const PI = 2*asin(1.0);

//window measures
const double WIN_WIDTH = 400;
const double WIN_HEIGTH = 400;
const int TEXT_HEIGHT = 20;
//default ortho projection volume
const double SCENE_WIDTH = 40;
const double SCENE_HEIGHT = 60;
const double SCENE_DEPTH = 100;
const double SCENE_AR = SCENE_WIDTH / SCENE_HEIGHT;
const double SCENE_BORDER = 0.1;
const int TIMER_MSECS = 1;

//Game Constants
const std::string PAC_MAP_FILE = "PackMan.txt";
const int UBER_MODE_TIME = 10000;

/// CAMERAS

//ORTOGONAL TOP VIEW CAMERA = 0

//ORTHO
const double ORTHO_ZNEAR = -10;
const double ORTHO_ZFAR = 10;

//FRUSTRUM
const double CAM_FOVY = 90;
const double CAM_AR = 1;
const double CAM_ZNEAR = .1;
const double CAM_ZFAR = 50;

//PERSPECTIVE TOP VIEW CAMERA = 1
const double CAM1_HEIGHT = 18;

//PERSPECTIVE FOLLOW CAMERA = 2
const double CAM1_X = 0;
const double CAM1_Y = -1;
const double CAM1_Z = +1;

typedef struct material Material;
struct material{
	GLfloat ambient[4];
	GLfloat diffuse[4];
	GLfloat specular[4];
	GLfloat shininess;
};


inline void setMaterial(Material mat){
	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, mat.ambient);
	glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, mat.diffuse);
	glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, mat.specular);
	glMaterialf (GL_FRONT, GL_SHININESS, mat.shininess);
}

// GAME CONSTANTS
const double SPHERE_SLICES = 30;
const double SPHERE_STACKS = 30;

// LIGHTS
const GLfloat LIGHT0_POSITION[] = { -1,0,1,0};
const GLfloat LIGHT0_AMBIENT[] = { .4,.4,.4 ,1};
const GLfloat LIGHT0_DIFFUSE[] = { 1,1,1,1};
const GLfloat LIGHT0_SPECULAR[] = { 1,1,1,1};

//WALL
const double WALL_SIDE = 1;
const double WALL_HEIGHT = .2;
const Material WALL_MAT ={ {0,0,0.1,1}, {.2,.3,1,1}, {0.5,0.5,0.5,1}, 30 };

// FLOOR
const Material FLOOT_MAT = { {0.1,0.1,0.1,1}, {.1,.1,.1,1}, {1,1,1,1}, 120};

//POINTS
const double SMALL_POINT_RADIUS = 0.1;
const double BIG_POINT_RADIUS = 0.2;
const Material POINT_MAT = {{.4,.4,.4,1}, {.6,.6,.6,1}, {1,1,1,1}, 100};
//PACMAN
const double PACMAN_NORMAL_SPEED = 10;
const double PACMAN_RADIUS = 0.5 ;
const Material PACMAN_MAT = { {.6,.6,0,1}, {.6,.6,0,1} , {1,1,1,1}, 40};
const Material PACMAN_EYE_MAT= { {.3,.3,.3,1}, {.6,.6,.6,1} , {1,1,1,1}, 80};
const Material PACMAN_IRIS_MAT= { {0,0,0,1}, {0,0,0,1} , {1,1,1,1}, 100};
const Material PACMAN_EYEBROW_MAT= { {0,0,0,1}, {0,0,0,1} , {1,1,1,1}, 100};

//GHOSTS
const double GHOST_NORMAL_SPEED = 10;

const double ghostColor[4][3]=
{
1,0,1,
0,1,1,
.5,.5,1,
1,1,1
};


const Material GHOSTS_EYE_MAT= { {.3,.3,.3,1}, {.6,.6,.6,1} , {1,1,1,1}, 80};
const Material GHOSTS_IRIS_MAT= { {0,0,0,1}, {0,0,0,1} , {1,1,1,1}, 100};
const Material GHOSTS_EYEBROW_MAT= { {0,0,0,1}, {0,0,0,1} , {1,1,1,1}, 100};
const GLfloat ak=.5;
const GLfloat dk=.8;
const Material GHOSTS_MATS[4]={
	{ {ak,0,ak,1} , {dk,0,dk,1} , {1,1,1,1} , 40 },
	{ {0,ak,ak,1} , {0,dk,dk, 1} , {1,1,1,1} , 40 },
	{ {.5*ak,.5*ak,1*ak,1},{.5*dk,.5*dk,1*dk,1} , {1 , 1 , 1 , 1} , 40 },
	{ {0,ak,0,1} , {0,dk,0,1} , {0,1,0,1} , 40 },
};
const Material GHOST_EDIBLE_MAT = { {0,0,ak,1}, {0,0,dk,1} , {1,1,1,1}, 40};


};



#endif /* CONSTANTS_H_ */
